<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">编辑api接口文档信息</li>
            </ol>
          </div>
        </div>
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="pull-right h-btn-group">
              <@permission btnType="save" btnId="saveBtn" btnValue="保存" op="api:apiFacadeDoc:save"
              btnMethod="ApiFacadeDocMgr.submitForm()"/>
            </div>
          </form>
        </div>

        <div class="form-horizontal  h-form-warp">
          <div class="h-msg-title h-table-header">
            <strong>api接口文档信息</strong>
          </div>
          <form action="/apiFacadeDoc/saveApiFacadeDoc" class="form-horizontal" id="apiFacadeDocForm" method="post"
                role="form">
            <input id="operation" name="operation" type="hidden" value="${operation!}"/>
            <input class="form-control" id="id" name="id" type="hidden" value="${apiFacadeDoc.id!}">
            <input class="form-control" id="projectId" name="projectId" type="hidden"
                   value="${apiFacadeDoc.projectId!}">
            <input class="form-control" id="moduleId" name="moduleId" type="hidden" value="${apiFacadeDoc.moduleId!}">
            <div class="form-group">
              <label class="col-sm-2 control-label">接口对应的项目信息 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="projectCode" name="projectCode" readonly="readonly"
                       required="required"
                       type="text" value="${apiFacadeDoc.projectCode!}"/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口对应的项目模块信息 ：</label>
              <div class="col-sm-6">
                <input class="form-control" id="moduleCode" name="moduleCode" readonly="readonly"
                       required="required"
                       type="text" value="${apiFacadeDoc.moduleCode!}"/>
              </div>
              <div class='col-sm-2'>
                <input class="primary-btn" id="selectModule" onclick="ApiFacadeDocMgr.selectModule()" type="button"
                       value='选择模块'/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口编码 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="apiFacadeCode" name="apiFacadeCode" required="required"
                       type="text"
                       value="${apiFacadeDoc.apiFacadeCode!}"/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口名称 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="apiFacadeName" name="apiFacadeName" required="required"
                       type="text"
                       value="${apiFacadeDoc.apiFacadeName!}"/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">接口版本 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="apiFacadeVersion" name="apiFacadeVersion" required="required"
                       type="text"
                       value="${apiFacadeDoc.apiFacadeVersion!}"/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label text-right">maven配置：</label>
              <div class="col-sm-8">
									 <textarea class="col-sm-12" id="apiFacadeMavenConfig" name="apiFacadeMavenConfig" required="required"
                             rows="70"
                             style="height:140px">${apiFacadeDoc.apiFacadeMavenConfig!}</textarea>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label text-right">接口说明：</label>
              <div class="col-sm-8">
									 <textarea class="col-sm-12" id="apiFacadeDesc" name="apiFacadeDesc" required="required"
                             rows="70" style="height:140px">${apiFacadeDoc.apiFacadeDesc!}</textarea>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <@PageDict dict_name="isPublic" dict_desc="是否对外公开" dict_key="std_zb_yn"
              dict_value="${apiFacadeDoc.isPublic!}" dict_type="select"
              label_class="col-sm-2 control-label" dict_class="col-sm-8" required="required" default_value="Y"/>
            </div>
          </form>
        </div>
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    function returnIndex() {
        window.location.href = "/apiFacadeDoc/query";
    }

    $(function () {
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        // 弹出窗体控制
        ApiFacadeDocMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                }
            },
            // init end

            // 提交数据
            submitForm: function () {
                Jmts.ajaxSubmit(document.getElementById("apiFacadeDocForm"), function (result) {
                    if (result.success) {
                        if (operation == 'add') {
                            ApiFacadeDocMgr.returnIndex();
                        } else {
                            Jmts.succTips(result.msg);
                            window.location.reload();
                        }
                    } else {
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/apiFacadeDoc/query";
            },
            selectModule: function () {//选择模块信息
                var url = "/apiFacadeModuleInfo/query_select?selectType=single&returnMethod=ApiFacadeDocMgr.initProjectModuleInfo";
                Jmts.openDialog("selectModule", url, "选择模块信息", 500, 800, 32);
            },
            initProjectModuleInfo: function (data) {
                var moduleInfo = data.split("#");
                var moduleId = moduleInfo[0];
                var moduleCode = moduleInfo[1];
                var projectId = moduleInfo[2];
                var projectCode = moduleInfo[3];
                $("#moduleId").val(moduleId);
                $("#moduleCode").val(moduleCode);
                $("#projectId").val(projectId);
                $("#projectCode").val(projectCode);
            }
        };
        // 执行初始化
        ApiFacadeDocMgr.init();
        // 前台验证表单
        $("#apiFacadeDocForm").validate();
    });
</script>
</body>
</html>
